package com.java2nb.novel.utils;

/**
 * 聚合支付方式枚举
 */
public enum AggPayWayEnum {
    ALI_LITE("ALI_LITE", "支付宝小程序"),
    ALI_JSAPI("ALI_JSAPI", "支付宝生活号"),
    WX_JSAPI("WX_JSAPI", "微信公众号"),
    WX_LITE("ALIPAY_LIFE", "微信小程序"),
    JS_PAY("WX_APP", "微信APP"),
    SDK_PAY("WX_H5", "微信H5") ;

    private final String code;
    private final String desc;

    AggPayWayEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // 校验支付方式是否合法
    public static boolean isValid(String code) {
        for (AggPayWayEnum e : values()) {
            if (e.code.equals(code)) return true;
        }
        return false;
    }

    // getter
    public String getCode() { return code; }
    public String getDesc() { return desc; }
}

